FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

WORKDIR /app

COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# 仅拷贝运行所需目录
COPY backend ./backend
COPY templates ./templates
COPY static ./static
COPY .env.example ./.env.example

# 与代码中相对路径保持一致（backend -> ../uploads）
ENV UPLOAD_FOLDER=../uploads

EXPOSE 8000

WORKDIR /app/backend
CMD ["python", "app.py"]
